package com.shop2cn.app.liveseller.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.shop2cn.app.liveseller.parameter.*;
import com.shop2cn.app.liveseller.service.*;
import com.ymttest.business.service.AuthCallServiceV2;
import com.ymttest.business.service.LiveRoomShop2cnCallService;
import com.ymttest.business.service.shenqi.GodmchManageCallService;
import com.ymttest.database.model.livesellerShop2cn.*;
import com.ymttest.database.sqlwapper.livesellerShop2cn.LiveRoomShop2cnWapper;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
/**
*买手（主播）删除直播
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_SetBuyerShow{
	private static SetBuyerShowBean SetBuyerShowBean;
	private static SetBuyerShowCall SetBuyerShowCall;
	private static LiveRoomShop2cnWapper LiveRoomShop2cnWapper;
	private static int sellerId ;
	private static String token ;
	private static int csId;
	private static String cstoken;
	
	@BeforeClass
	public static void setUp() throws Exception {
		Logger.createResultFile("买手（主播）删除直播");
		sellerId = GodmchManageCallService.CreateSellerMch();
		token=AuthCallServiceV2.createToken(sellerId, "app");
		csId = GodmchManageCallService.bindClientService(
				sellerId, 1);
		cstoken = AuthCallServiceV2.createToken(csId, "app");
	}

	@Before
	public void caseUp() {
		SetBuyerShowBean=new SetBuyerShowBean();
		SetBuyerShowCall=new SetBuyerShowCall();
		LiveRoomShop2cnWapper=new LiveRoomShop2cnWapper();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(SetBuyerShowCall.getOpurl());
		LiveRoomShop2cnWapper=null;
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SetBuyerShow_001() {
		Logger.start(true,"设置直播间是否在卖家端露出成功");
		try {
			LiveRoom createlive = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnWapper.updateLiveRoomPushStatus(createlive.getId(), 7);
			SetBuyerShowBean.setLiveId(createlive.getId());
			SetBuyerShowBean.setBuyerShow(false);
			SetBuyerShowCall.setData(SetBuyerShowBean);
			String head="accesstoken="+token;
			SetBuyerShowCall.addHeader("ymt-pars", head);
			SetBuyerShowCall.callService();			
			Logger.verifyEquals("{}", SetBuyerShowCall.getReturnData(), "验证Code");
			LiveRoom dblive = LiveRoomShop2cnWapper.selectLiveRoomById(createlive.getId());
			Logger.verifyEquals(false, dblive.getBuyerShow(), "验证getBuyerShow");
			SetBuyerShowBean.setBuyerShow(true);
			SetBuyerShowCall.callService();			
			Logger.verifyEquals("{}", SetBuyerShowCall.getReturnData(), "验证Code");
			dblive = LiveRoomShop2cnWapper.selectLiveRoomById(createlive.getId());
			Logger.verifyEquals(true, dblive.getBuyerShow(), "验证getBuyerShow");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}